|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.piratis.j2me.core.game.LayerManager
As in MIDP2.0, the LayerManager manages Layers. The LayerManager
simplifies the process of rendering the Layers that have been added
to it by automatically rendering the correct regions of each Layer
in the appropriate order.
The LayerManager mantains an ordered list to which Layers can be
appended, inserted and removed. Its index in the list correlates to
its z-order: index 0 is closest to the user, while the higher index, the
further from the user.
TODO: is it necessary to keep an own bbox?
Constructor Summary | |
LayerManager()
Creates a new LayerManager |
Method Summary | |
void |
add(Layer l)
Appends a Layer to this LayerManager. |
Layer |
getLayerAt(int idx)
Gets the layer at the specified index |
int |
getSize()
Gets the number of layers |
BBox2D |
getWindow()
Retrieve the current world window |
void |
insertAt(Layer l,
int idx)
Inserts a Layer at a given position. |
void |
paint(Graphics g,
int x,
int y)
Renders the LayerManager's Layers. |
void |
remove(Layer l)
Deletes the Layer from this LayerManager. |
void |
setWindow(BBox2D other)
Sets the view window on the LayerManager |
void |
setWindow(int x,
int y,
int width,
int height)
Sets the view window on the LayerManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LayerManager()
Method Detail |
public void add(Layer l)
l
- public void insertAt(Layer l, int idx)
l
- Layeridx
- where to insert the layerpublic Layer getLayerAt(int idx)
idx
- the index
java.lang.IndexOutOfBoundsException
- if element not found at the
specified indexpublic int getSize()
public void remove(Layer l)
l
- the Layer to be removedpublic void paint(Graphics g, int x, int y)
g
- to draw the LayerManagerx
- horizontal location at which to render the view windowy
- vertical location at which to render the view windowsetWindow(int, int, int, int)
public void setWindow(int x, int y, int width, int height)
x
- left relative to the LayerManager's originy
- top idem.width
- height
- public void setWindow(BBox2D other)
other
- the new view windowsetWindow(int, int, int, int)
public BBox2D getWindow()
|
Copyright(c) 2003-2004 Jordi Martin | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |